<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增慢病分类管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ill-add">
            <div class="form-group">
                <label class="col-sm-3 control-label">疾病编号：</label>
                <div class="col-sm-8">
                    <input id="illId" name="illId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">拼音码：</label>
                <div class="col-sm-8">
                    <input name="illPinyin" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">疾病名称：</label>
                <div class="col-sm-8">
                    <input name="illName" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/ill"
        $("#form-ill-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            let illId = $("#illId").val();
            $.ajax ({
                url: '/system/ill/listAjax',
                type: 'post',
                dataType: 'json',
                data: {"illId": illId},
                success: function(data) {
                    if (data.res == 'success') {
                        if ($.validate.form()) {
                            $.operate.save(prefix + "/add", $('#form-ill-add').serialize());
                        }
                    } else {
                        $.modal.msgError("疾病编号重复！");
                    }
                }
            });
        }
    </script>
</body>
</html>
